package moniMaipiao;

public class runableImpl {
    public static void main(String[] args) {
        runableImSon r1 = new runableImSon();
        Thread t1 = new Thread(r1,"窗口1");
        t1.start();

        Thread t2 = new Thread(r1,"窗口2");
        t2.start();

        Thread t3 = new Thread(r1,"窗口3");
        t3.start();


    }
}

class runableImSon implements Runnable{
    private int ticket = 100;
    @Override
    public void run() {
        while (true){
            if(ticket <=0){
                break;
            }
            System.out.println(Thread.currentThread().getName()+ "卖出了第" + ticket+"张票");
            ticket--;
        }
    }
}